import org.junit.*;
import org.junit.runner.*;
import org.junit.runner.notification.*;
import static org.junit.Assert.*;
import java.util.Arrays;

public class MinStackTest {

    public static void main(String[] args) {
        Result result = JUnitCore.runClasses(MinStackTest.class);
        for (Failure failure : result.getFailures()) {
            System.out.println(failure.getTestHeader() + ": " + failure.getMessage());
        }
        System.out.println(result.wasSuccessful());
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }
    
    @Test
    public void test1() throws Exception {
        MinStack<Integer> stack = new MinStack<Integer>();
        stack.push(0);
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(4);

        assertEquals("1. Stack size test", 5, stack.size());
    }

    @Test
    public void test2() throws Exception {
        MinStack<Integer> stack = new MinStack<Integer>();
        stack.push(0);
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(4);

        assertEquals("2. Peek test", 4, (int)stack.peek());
    }

    @Test
    public void test3() throws Exception {
        MinStack<Integer> stack = new MinStack<Integer>();

        assertEquals("3. Null test", null, stack.pop());
    }

    @Test
    public void test4() throws Exception {
        MinStack<String> stack = new MinStack<String>();
        stack.push("1");
        stack.push("2");
        stack.push("3");

        assertEquals("4. String format test", "3", stack.pop());
    }

    @Test
    public void test5() throws Exception {
        MinStack<Integer> stack = new MinStack<Integer>();
        stack.push(5);
        stack.push(-1);
        stack.push(2);
        stack.push(4);

        assertEquals("5. Min() test", -1, (int)stack.min());
    }

}

